/*
 * DemoSoundState.h
 *
 *  Created on: 2011-11-21
 *      Author: baixp
 */

#ifndef DEMOSOUNDSTATE_H_
#define DEMOSOUNDSTATE_H_
#include "Lib9.h"
#include "L9Sound.h"
using namespace lib9bada;
class DemoSoundState: public Lib9, public L9IState  {
public:
	DemoSoundState(Application* pApp);
	virtual ~DemoSoundState();
    //文字资源常量，由Lib9Editor编辑器在导出文本资源的时候自动生成
    static const int K_SOUND_BGMUSIC = 0;
    static const int K_SOUND_DIE=1;

	L9Sprite* pSprite;
    L9Sound* pSound;

	void Init() {
		// TODO Auto-generated method stub
	}

	void Update() {
		// TODO Auto-generated method stub
		if (isKeyPressed(K_KEY_5 | K_KEY_OK)||getPointerX() > 0) {
			//showMsgDialog函数中已经将当前状态入栈了
			//			pushState();
//			showMsgDialog("消息对话框", "你能0xFF0000看见0x000000这个消息对话框吗？", "确认", 180);
	//		showYesNoDialog("消息对话框", "你能0xFF0000看见0x000000这个消息对话框吗？", "确认","退出", 180);

			pSound->playSound(0,K_SOUND_DIE,3);
		}
	}

	void Paint() {
		// TODO Auto-generated method stub
		fillScreen(0xFFFFFFFF);
		pFG->SetForegroundColor(0xFFFF0000); //画笔颜色
		pL9Str->drawLine(pFG, "按5键播放背景音乐", 0, SCR_H / 2, SCR_W,L9Str::K_Line_Align_Center);
	}
};

#endif /* DEMOSOUNDSTATE_H_ */
